<div class="problemindexholder" problemindex="A">
 <div class="ttypography">
  <div class="problem-statement">
   <div class="header">
    <div class="title">
     A. Unimodal Array
    </div>
    <div class="time-limit">
     <div class="property-title">
      time limit per test
     </div>
     1 second
    </div>
    <div class="memory-limit">
     <div class="property-title">
      memory limit per test
     </div>
     256 megabytes
    </div>
    <div class="input-file">
     <div class="property-title">
      input
     </div>
     standard input
    </div>
    <div class="output-file">
     <div class="property-title">
      output
     </div>
     standard output
    </div>
   </div>
   <div>
    <p>
     Array of integers is
     <span class="tex-font-style-it">
      unimodal
     </span>
     , if:
    </p>
    <ul>
     <li>
      it is strictly increasing in the beginning;
     </li>
     <li>
      after that it is constant;
     </li>
     <li>
      after that it is strictly decreasing.
     </li>
    </ul>
    <p>
     The first block (increasing) and the last block (decreasing) may be absent. It is allowed that both of this blocks are absent.
    </p>
    <p>
     For example, the following three arrays are unimodal:
     <span class="tex-span">
      [5, 7, 11, 11, 2, 1]
     </span>
     ,
     <span class="tex-span">
      [4, 4, 2]
     </span>
     ,
     <span class="tex-span">
      [7]
     </span>
     , but the following three are not unimodal:
     <span class="tex-span">
      [5, 5, 6, 6, 1]
     </span>
     ,
     <span class="tex-span">
      [1, 2, 1, 2]
     </span>
     ,
     <span class="tex-span">
      [4, 5, 5, 6]
     </span>
     .
    </p>
    <p>
     Write a program that checks if an array is unimodal.
    </p>
   </div>
   <div class="input-specification">
    <div class="section-title">
     Input
    </div>
    <p>
     The first line contains integer
     <span class="tex-span">
      <i>
       n
      </i>
     </span>
     (
     <span class="tex-span">
      1 ≤
      <i>
       n
      </i>
      ≤ 100
     </span>
     ) — the number of elements in the array.
    </p>
    <p>
     The second line contains
     <span class="tex-span">
      <i>
       n
      </i>
     </span>
     integers
     <span class="tex-span">
      <i>
       a
      </i>
      <sub class="lower-index">
       1
      </sub>
      ,
      <i>
       a
      </i>
      <sub class="lower-index">
       2
      </sub>
      , ...,
      <i>
       a
      </i>
      <sub class="lower-index">
       <i>
        n
       </i>
      </sub>
     </span>
     (
     <span class="tex-span">
      1 ≤
      <i>
       a
      </i>
      <sub class="lower-index">
       <i>
        i
       </i>
      </sub>
      ≤ 1 000
     </span>
     ) — the elements of the array.
    </p>
   </div>
   <div class="output-specification">
    <div class="section-title">
     Output
    </div>
    <p>
     Print "
     <span class="tex-font-style-tt">
      YES
     </span>
     " if the given array is unimodal. Otherwise, print "
     <span class="tex-font-style-tt">
      NO
     </span>
     ".
    </p>
    <p>
     You can output each letter in any case (upper or lower).
    </p>
   </div>
   <div class="sample-tests">
    <div class="section-title">
     Examples
    </div>
    <div class="sample-test">
     <div class="input">
      <div class="title">
       Input
      </div>
      <pre>6<br/>1 5 5 5 4 2<br/></pre>
     </div>
     <div class="output">
      <div class="title">
       Output
      </div>
      <pre>YES<br/></pre>
     </div>
     <div class="input">
      <div class="title">
       Input
      </div>
      <pre>5<br/>10 20 30 20 10<br/></pre>
     </div>
     <div class="output">
      <div class="title">
       Output
      </div>
      <pre>YES<br/></pre>
     </div>
     <div class="input">
      <div class="title">
       Input
      </div>
      <pre>4<br/>1 2 1 2<br/></pre>
     </div>
     <div class="output">
      <div class="title">
       Output
      </div>
      <pre>NO<br/></pre>
     </div>
     <div class="input">
      <div class="title">
       Input
      </div>
      <pre>7<br/>3 3 3 3 3 3 3<br/></pre>
     </div>
     <div class="output">
      <div class="title">
       Output
      </div>
      <pre>YES<br/></pre>
     </div>
    </div>
   </div>
   <div class="note">
    <div class="section-title">
     Note
    </div>
    <p>
     In the first example the array is unimodal, because it is strictly increasing in the beginning (from position
     <span class="tex-span">
      1
     </span>
     to position
     <span class="tex-span">
      2
     </span>
     , inclusively), that it is constant (from position
     <span class="tex-span">
      2
     </span>
     to position
     <span class="tex-span">
      4
     </span>
     , inclusively) and then it is strictly decreasing (from position
     <span class="tex-span">
      4
     </span>
     to position
     <span class="tex-span">
      6
     </span>
     , inclusively).
    </p>
   </div>
  </div>
  <p>
  </p>
 </div>
</div>
